package com.itheima.edu.info.manager.dao;

import com.itheima.edu.info.manager.domain.Teacher;

public class TeacherDao {
    static private Teacher[] ArrayTeacher = new Teacher[5];
    public boolean addTeacher(Teacher stn) {
        boolean flog = false;
        int index = -1;
        for (int i = 0; i < ArrayTeacher.length; i++) {
            if (ArrayTeacher[i] == null){
                index = i;
                ArrayTeacher[index] = stn;
                flog = true;
                break;
            }
        }
        return flog;

    }

    public Teacher[] findAllTeacher() {
        return ArrayTeacher;
    }

    public void removeTeacher(int index) {
        ArrayTeacher[index] = null;
    }


    public void changeTeacher(com.itheima.edu.info.manager.domain.Teacher stn, int index) {
        ArrayTeacher[index].setName(stn.getName());
        ArrayTeacher[index].setAge(stn.getAge());
        ArrayTeacher[index].setBirthday(stn.getBirthday());
    }
}
